package com.kc.web.controller.business;

import com.kc.business.domain.BizCulturalOrder;
import com.kc.business.service.IBizCulturalOrderService;
import com.kc.common.annotation.Log;
import com.kc.common.annotation.RepeatSubmit;
import com.kc.common.core.controller.BaseController;
import com.kc.common.core.domain.AjaxResult;
import com.kc.common.core.page.TableDataInfo;
import com.kc.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * TODO
 *
 * @author zhangshuo
 * @version 1.0
 * @date 2020/9/28
 */
@RestController
@RequestMapping("/business/culturalOrder")
public class BizCulturalOrderController extends BaseController {
    @Autowired
    private IBizCulturalOrderService culturalOrderService;

    /**
     * 文创订单列表
     */
    @PreAuthorize("@ss.hasPermi('business:culturalOrder:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizCulturalOrder culturalOrder) {
        startPage();
        List<BizCulturalOrder> list = culturalOrderService.getList(culturalOrder);
        return getDataTable(list);
    }

    /**
     * 文创订单审核
     */
    @PreAuthorize("@ss.hasPermi('business:culturalOrder:edit')")
    @Log(title = "文创订单审核", businessType = BusinessType.UPDATE)
    @PutMapping
    @RepeatSubmit
    public AjaxResult edit(@RequestBody @Validated BizCulturalOrder bizShopEnterForm) {
        return toAjax(culturalOrderService.edit(bizShopEnterForm));
    }
}
